/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.fox.iebav.entity;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author waldenilson
 */
@Entity
@Table(name = "responsavelempresa")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Responsavelempresa.findAll", query = "SELECT r FROM Responsavelempresa r")})
public class Responsavelempresa implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @SequenceGenerator(name="seqresponsavelempresa",sequenceName="responsavelempresa_id_seq",allocationSize=1)
    @GeneratedValue(generator="seqresponsavelempresa",strategy=GenerationType.SEQUENCE)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Column(name = "nome")
    private String nome;
    @Column(name = "cpf")
    private String cpf;
    @Column(name = "senha")
    private String senha;
    @Column(name = "cargo")
    private String cargo;
    @Column(name = "email")
    private String email;
    @JoinColumn(name = "empresa", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Empresas empresa;
//    @OneToMany(cascade = CascadeType.ALL, mappedBy = "responsavel")
//    private List<Empresas> empresasList;

    public Responsavelempresa() {
    }

    public Responsavelempresa(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getNome() {
        return nome;
    }

    public void setNome(String nome) {
        this.nome = nome;
    }

    public String getCpf() {
        return cpf;
    }

    public void setCpf(String cpf) {
        this.cpf = cpf;
    }

    public String getSenha() {
        return senha;
    }

    public void setSenha(String senha) {
        this.senha = senha;
    }

    public String getCargo() {
        return cargo;
    }

    public void setCargo(String cargo) {
        this.cargo = cargo;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

//    @XmlTransient
//    public List<Empresas> getEmpresasList() {
//        return empresasList;
//    }
//
//    public void setEmpresasList(List<Empresas> empresasList) {
//        this.empresasList = empresasList;
//    }

    public Empresas getEmpresa() {
		return empresa;
	}

	public void setEmpresa(Empresas empresa) {
		this.empresa = empresa;
	}

	@Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Responsavelempresa)) {
            return false;
        }
        Responsavelempresa other = (Responsavelempresa) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.com.fox.iebav.entity.Responsavelempresa[ id=" + id + " ]";
    }
    
}
